#ifndef FRIENDLISTFORM_H
#define FRIENDLISTFORM_H

#include <QWidget>
#include <data/UserInfo.pb.h>
using namespace proto;
#include <QListWidgetItem>
#include <forms/items/useritem.h>
#include <forms/mainwindow/WindowManager.h>

namespace Ui {
    class FriendListForm;
}

class FriendListForm : public QWidget {
    Q_OBJECT

public:
    explicit FriendListForm(WindowManager& manager, QWidget* parent = nullptr);
    ~FriendListForm();

protected:
    void init();
    void initFriendsList();
    void addWidget(data::FriendInfo& info);

    void onGetFriendsList(int code);
    void onAddFriends(int code, QString message, std::shared_ptr<::proto::data::FriendInfo> info);
    void onItemClicked(QListWidgetItem* item);
    void onItemDoubleClicked(QListWidgetItem* item);
signals:
    void signalToggle();

private:
    Ui::FriendListForm*                 ui;
    std::map<QString, std::shared_ptr<data::FriendInfo>> m_firends;
    WindowManager&                      manager;
};

#endif  // FRIENDLISTFORM_H
